package com.ikun.common.observer.impl;



import com.ikun.common.observer.base.Observer;
import com.ikun.common.observer.base.Subject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author ximeng
 * @title: SubjectImpl
 * @projectName iot-fy-2301-parent
 * @description: TODO
 * @date 2023/10/8  15:22
 */
@Component
@Slf4j
public class SubjectImpl implements Subject {
    @Autowired
    private List<Observer> observerList;
    @Override
    public void notifyAll(String msg) {
        for (int i = 0; i < observerList.size(); i++) {
            observerList.get(i).notifyAll(msg);
        }
    }
}
